﻿@using EquipmentManager.Entities
@model EquipmentManager.Models.CreateModel<User>

@{
    ViewBag.Title = "Добавить нового пользователя в район " + Model.Instance.Region.Name;
}

@section menu {
    <section class="featured">
            <div class="master-menu">
                @{Html.RenderPartial("AdminMenu");}
            </div>
    </section>
}

<h2>Добавить нового пользователя в район @Model.Instance.Region.Name</h2>

@using (Html.BeginForm("CreateUser", "Admin", FormMethod.Post, new { @class = "" }))
{
    @Html.HiddenFor(model => model.ParentId)
    
    <table class="bordered">
        <tr>
            <td class="vertical-header">Логин</td>
            <td>@Html.EditorFor(model => model.Instance.UserName, new { @class = "" })</td>
        </tr>
        <tr>
            <td class="vertical-header">Пароль</td>
            <td>@Html.EditorFor(model => model.Instance.Password, new { @class = "" })</td>
        </tr>
        <tr>
            <td class="vertical-header">Полное имя</td>
            <td>@Html.EditorFor(model => model.Instance.FullName, new { @class = "" })</td>
        </tr>
        <tr>
            <td class="vertical-header">Роль</td>
            <td>@Html.DropDownListFor(model => model.Instance.Role, new SelectList(Enum.GetValues(typeof(UserRole))))</td>
        </tr>
    </table>
    
    @Html.ValidationSummary();

    <p>
        @Html.ActionLink("Отмена", "PostOffices", new { RegionId = @Model.ParentId }, new { @class = "common-btn-large BlueColor" }) <input type="submit" value="Добавить" class="common-btn-large BlueColor" />
    </p>
}